﻿#if !NETCOREAPP
using GameFramework.Network.MessagePack;
using GameFramework.Request;
#endif
using MessagePack;

namespace Server.Proto
{
    /// <summary>
    /// 登陆请求
    /// </summary>
    [MessagePackObject(true)]
    public class LoginReq : RequestMessage
    {
        [IgnoreMember]
        public const int RouteKey = (int)RouteDefine.LoginReq;
        
        [IgnoreMember]
        public override int Route => RouteKey;
        
        /// <summary>
        /// 平台类型
        /// </summary>
        public GamePlatform Platform { get; set; }
        
        /// <summary>
        /// 设备id
        /// </summary>
        public string DeviceId { get; set; }
        
        /// <summary>
        /// 账号id
        /// </summary>
        public long AccountId { get; set; }
        
        /// <summary>
        /// 登录票据 登录一次后就失效 后续重连需要试用LoginResp返回的ReconnectToken
        /// </summary>
        public string LoginToken { get; set; }

        public override void OnRecycle()
        {
            base.OnRecycle();
            Platform = default;
            DeviceId = string.Empty;
            AccountId = default;
            LoginToken = string.Empty;
        }
    }
}